package com.exia.android.socialnet.facebook;

import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

import com.facebook.android.FacebookError;
import com.facebook.android.Util;

public class FacebookUploadListener extends FacebookRequestListener {
	
	FacebookUploadListener(FacebookActivity activity_p){
		super(activity_p);
	}
	
	@Override
	public void onComplete(final String response) {
        if((activity != null)){
        	/*
        	try {
                // process the response here: (executed in background thread)
                Log.d("Facebook-Example", "Response: " + response.toString());
                JSONObject json = Util.parseJson(response);
                final String src = json.getString("src");

                // then post the processed result back to the UI thread
                // if we do not do this, an runtime exception will be generated
                // e.g. "CalledFromWrongThreadException: Only the original
                // thread that created a view hierarchy can touch its views."
                activity.runOnUiThread(new Runnable() {
                    public void run() {
                        activity.mText.setText("Hello there, photo has been uploaded at \n" + src);
                    }
                });
            } catch (JSONException e) {
                Log.w("Facebook-Example", "JSON Error in response");
            } catch (FacebookError e) {
                Log.w("Facebook-Example", "Facebook Error: " + e.getMessage());
            }
            */
        }
    }

}
